//
//  WYPusherHeaderCell.m
//  CirclePush
//
//  Created by admin on 2018/4/18.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYPusherHeaderCell.h"
@interface WYPusherHeaderCell()
@property (strong, nonatomic) IBOutlet UIImageView *userImageView;

@property (strong, nonatomic) IBOutlet UILabel *userName;
@property (strong, nonatomic) IBOutlet UILabel *orderCount;
@property (strong, nonatomic) IBOutlet UILabel *orderPrice;




@end


@implementation WYPusherHeaderCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self setUpUI];
    
    UITapGestureRecognizer *ges = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(lookAtTheTwitter)];
    self.userImageView.userInteractionEnabled = YES;
    [self.userImageView addGestureRecognizer:ges];
    
    
    
}

-(void)lookAtTheTwitter
{
    
    if ([self.delegate respondsToSelector:@selector(clickUserImageView)]) {
        [self.delegate clickUserImageView];
    }
    
    
}


-(void)setUpUI
{
    
    [self.userImageView setCornerRadius:25.0f];
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)setInfo:(WYClewInfo *)info
{
    self.userName.text = info.name;
    [self.userImageView sd_setImageWithURL:[NSURL URLWithString:info.head]];
    
    if ([info.count objectForKey:@"count"]) {
        self.orderCount.text = info.count[@"count"];
        
        
    }else{
        self.orderCount.text =@"0";
        
    }
    if ([info.count objectForKey:@"commission"]) {
        NSString *price = info.count[@"commission"];
        self.orderPrice.text = [NSString stringWithFormat:@"%.2f",price.floatValue];
        
        
    }else{
        self.orderPrice.text = @"0.00";
        
        
    }
    
}
- (IBAction)clickAction:(id)sender {
    
    if ([self.delegate respondsToSelector:@selector(clickExtractAction)]) {
        [self.delegate clickExtractAction];
    }
    
}



@end
